package com.fushenlan.epidemicControl.controller;

import com.fushenlan.commons.GeneralResponse;
import com.fushenlan.epidemicControl.service.AreaService;
import com.fushenlan.po.Area;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author XUJIN
 * @DATE 2022/4/21
 * @PACKAGE_NAME com.fushenlan.epidemicControl.controller
 * @VERSION 1.0
 * 国标数据信息管理控制器
 */
@Slf4j
@RestController
@RequestMapping("area")
@Api(value = "国标数据信息管理控制器", description = "国标数据信息管理控制器", tags = "area-controller")
public class AreaController {

    @Autowired
    private AreaService areaService;

    @GetMapping("getSubArea")
    @ApiOperation(value = "根据区域id获取下级行政区域", notes = "根据id获取下级行政区域")
    public GeneralResponse getSubArea(@ApiParam(value = "区域id 获取所有省 填0", required = true) @RequestParam String id) {
        Area area = new Area();
        area.setPid(id);
        List<Area> list = areaService.findList(area);
        return GeneralResponse.success(list);
    }



}
